//
//  UIButton+Extension.swift
//  Weibo
//
//  Created by gdarkness on 16/3/28.
//  Copyright © 2016年 gdarkness. All rights reserved.
//

import UIKit

extension UIButton {
    
    convenience init(title: String, imagName: String, backgroundImageNmae: String = "timeline_card_bottom_background", textColor: UIColor = UIColor.lightGrayColor(), textFont: CGFloat = StatusCellBottomDefaultFontSize) {
        self.init()
        
        //设置
        self.setBackgroundImage(UIImage(named: backgroundImageNmae), forState: UIControlState.Normal)
        self.setBackgroundImage(UIImage(named: "\(backgroundImageNmae)_highlighted"), forState: UIControlState.Highlighted)
        self.setImage(UIImage(named: backgroundImageNmae), forState: UIControlState.Normal)
        self.setTitle(title, forState: UIControlState.Normal)
        self.setTitleColor(textColor, forState: UIControlState.Normal)
        self.titleLabel?.font = UIFont.systemFontOfSize(textFont)
    }
    
}
